package com.gzy.cbrsystem.core.insomnia;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.mapping.Collection;

import com.gzy.cbrsystem.core.BooleanSimilarity;
import com.gzy.cbrsystem.core.interfaces.CaseRepresentation;
import com.gzy.cbrsystem.core.interfaces.SimilarityCalculation;
import com.gzy.cbrsystem.insomnia.ClinicalBit;
import org.apache.commons.collections.CollectionUtils;   

public class InsomniaCaseRepresentation implements CaseRepresentation {

	Field caseId;
	List<Field> fields=new ArrayList();
	Map<Field,Double> weights=new HashMap();
	SimilarityCalculation attSimilarity;
	public InsomniaCaseRepresentation()
	{
		this.init();
	}
	public void init()
	{
		attSimilarity=new BooleanSimilarity();
		CollectionUtils.addAll(fields,ClinicalBit.class.getFields());
		try {
			caseId = ClinicalBit.class.getField("caseId");
			boolean t=fields.remove(caseId);
			if(!t) System.out.print("Can not remove Field caseId");
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (NoSuchFieldException e) {
			e.printStackTrace();
		}
		for(Field field:fields)
		{
			weights.put(field, new Double(1));
		}
	}
	
	public SimilarityCalculation getAttSimilarity() {
		return this.attSimilarity;
	}
	public List<Field> getAttributes() {
		
		return this.fields;
	}
	public Map<Field, Double> getWeights() {
		return this.weights;
	}
}
